package com.lvfeng.test.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * java配置类，springboot4.0出现
 * @author LvFeng
 * 使用注解：@Configuration 表明了这是个控制类，控制类里一般存在@Bean注解
 *
 */
@Configuration
//@ComponentScan(basePackages = "com.lvfeng.test.config")   //ignoreResourceNotFound自动忽略没找到的配置文件
@PropertySource(value = {"classpath:application-dev.properties","application.properties"},ignoreResourceNotFound = true)
public class HelloConfig {
    @Value("${lvfeng.msg}")
	private String weather_api_key;

    @Bean
    public String getWeather_api_key(){
        return weather_api_key;
    }
}
